<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>地图导航</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    #container {
        width: 100%;
        height: 100vh;
        background-color: while
    }
</style>

<body>
<div id="container"></div>
<script type="text/javascript">
    window._AMapSecurityConfig = {
    securityJsCode:'c9782bb8b499fc243345907db0d9a621',
}
</script>
<script type="text/javascript"
        src="https://webapi.amap.com/maps?v=1.4.15&key=7e4e3e7b5dcc10188dace108c2825ed8"></script>
<script type="text/javascript">
          //地图初始化应该在地图容器div已经添加到DOM树之后
          var map = new AMap.Map("container", {
            zoom: 15,//级别
            center: [116.546562,39.91289],//中心坐标
          });

         function beginDriving(start,end){
            AMap.plugin(["AMap.Driving"], function() { //加载驾车服务插件
               var drivingOptions = {
                   //驾车策略，包括 LEAST_TIME，LEAST_FEE, LEAST_DISTANCE,REAL_TRAFFIC
                   policy: AMap.DrivingPolicy.LEAST_TIME,
                   map
               };
               var driving = new AMap.Driving(drivingOptions);
               //根据起终点坐标规划驾车路线
               var points = [{keyword:start}, {keyword: end}]
               driving.search(points, function(status, result){

               });
            });
         }

         //在javascript中这样调用函数是错误的：beginDriving(上海火车站,杭州东站)
          //正确的方式：beginDriving('上海火车站','杭州东站')
</script>
</body>

</html>